Skip to content

ghc: 9.6.6-debian-binary for powerpc64le, too#489139

Open
nwf wants to merge 1 commit intoNixOS:masterfrom
nwf:202602-ppc64le_ghc_debian_too
Open

ghc: 9.6.6-debian-binary for powerpc64le, too#489139
nwf wants to merge 1 commit intoNixOS:masterfrom
nwf:202602-ppc64le_ghc_debian_too

Conversation

@nwf
Copy link
Copy Markdown
Contributor

@nwf nwf commented Feb 10, 2026

Build on #439258 to bootstrap GHC on powerpc64le in the same way: using the Debian package.

Move the conditionals in top-level/haskell-packages.nix to probe for support from the 9.6.6-debian-binary.nix package so it's easier to do the same thing for other architectures, too, should anyone else need it.

Things done

@nixpkgs-ci nixpkgs-ci Bot added the 12.first-time contribution This PR is the author's first one; please be gentle! label Feb 10, 2026
@nwf nwf force-pushed the 202602-ppc64le_ghc_debian_too branch from 66385bc to 1b37e4b Compare February 10, 2026 18:22
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 6.topic: haskell General-purpose, statically typed, purely functional programming language labels Feb 10, 2026
Comment thread pkgs/top-level/haskell-packages.nix Outdated
# No bindist, "borrowing" the GHC from Debian
useDebianBinaryOr =
pkg:
if lib.meta.availableOn stdenv.hostPlatform bb.packages.ghc966DebianBinary.ghc then
Copy link
Copy Markdown
Contributor

@OPNA2608 OPNA2608 Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We allow targeting either ELF ABI version (ELFv1 or ELFv2) on glibc. The binary fetched from Debian is glibc ELFv1. lib.meta.availableOn does not care about the ELF ABI, hence the check for isAbiElfv1.

nix-instantiate --eval --strict --expr 'with import ./. { crossSystem = "powerpc64-unknown-linux-gnuabielfv2"; }; lib.meta.availableOn stdenv.hostPlatform haskell.compiler.ghc966DebianBinary'
true

The patchelf call to set the interpreter would link the ELFv1 binary to the ELFv2 interpreter, which will likely not be a functional combination.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Rats; I'd hoped that could be nicely encapsulated. I guess I should add a predicate field to each of the ghcDebs entries and wire that up to the things availableOn looks at?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better or worse, the conditions should be written out in haskell-packages.nix. We don't want to evaluate anything from ghc966DebianBinary unless we are actually going to use it.

Copy link
Copy Markdown
Contributor Author

@nwf nwf Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is such evaluation expensive?

ETA: tweaked the PR so that it asks the Debian ghc package from 9.6.6-debian-binary.nix‎ directly rather than going through the gyrations of building up and evaluating packagesBuildBuild.haskell.ghc966DebianBinary.ghc .

@nwf nwf force-pushed the 202602-ppc64le_ghc_debian_too branch from 1b37e4b to c590cae Compare February 11, 2026 02:35
@nwf
Copy link
Copy Markdown
Contributor Author

nwf commented Feb 11, 2026

I've tried reworking the meta.platforms logic to allow for additional constraints per package in addition to filtering by the system double used to key into the set of packages defined.

--replace-fail powerpc64-linux-gnu-ld ld \
--replace-fail powerpc64-linux-gnu-ar ar \
--replace-fail powerpc64-linux-gnu-ranlib ranlib \
--replace-fail ${stdenv.hostPlatform.system}-gnu-gcc gcc \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better tie this to the selected attribute name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the selected attribute name? Do you want me to add a key to the attrsets in ghcDebs (like platforms) that can override this value?

@nwf nwf force-pushed the 202602-ppc64le_ghc_debian_too branch from c590cae to 274f2e0 Compare February 22, 2026 18:49
@nixpkgs-ci nixpkgs-ci Bot removed the 12.first-time contribution This PR is the author's first one; please be gentle! label Feb 22, 2026
Comment thread pkgs/top-level/haskell-packages.nix Outdated
Comment on lines +97 to +102
useDebianBinaryOr =
pkg:
if lib.meta.availableOn stdenv.hostPlatform ghc966DebianBinary then
bb.packages.ghc966DebianBinary
else
pkg;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads like "use debian by default, fallback to others if not available" - which is not what we want. I know it actually doesn't do it, because the platforms for the debian bindist and the regular bindists don't overlap, but still...

How about we do something like if availableOn hostPlatform pkg then pkg else if availableOn hostPlatform ghc966DebianBinary then ghc966DebianBinary? Aka only fallback to debian if not otherwise available.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that having to be availableOn hostPlatform pkg.ghc, which threw me for a moment, that seems like a good idea. :)

Build on NixOS#439258 to bootstrap GHC on
powerpc64le in the same way: using the Debian package.

Move the conditionals in top-level/haskell-packages.nix to probe for support
from the 9.6.6-debian-binary.nix package so it's easier to do the same thing for
other architectures, too, should anyone else need it.
@nwf nwf force-pushed the 202602-ppc64le_ghc_debian_too branch from 274f2e0 to 5775639 Compare March 1, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants